﻿using OD.ProjectCustomizationTool.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OD.ProjectCustomizationTool.Tools
{
    internal sealed class NameSpacer : ProjectUpdaterBase
    {

        private const String Prefix = "OD.";

        #region Methods

        protected override void InternalUpdate()
        {
            var rootNamespace = this.CurrentProject.GetPropertyValue(Properties.Resources.RootNamespaceProjectProperty);
            if (!rootNamespace.StartsWith(NameSpacer.Prefix, StringComparison.OrdinalIgnoreCase))
                this.SetProjectProperty(Properties.Resources.RootNamespaceProjectProperty, NameSpacer.Prefix + rootNamespace);

            var assemblyName = this.CurrentProject.GetPropertyValue(Properties.Resources.AssemblyNameProjectProperty);
            if (!assemblyName.StartsWith(NameSpacer.Prefix, StringComparison.OrdinalIgnoreCase))
                this.SetProjectProperty(Properties.Resources.AssemblyNameProjectProperty, NameSpacer.Prefix + assemblyName);
        }

        #endregion

    }
}
